package src.shop.playhan.ui.components.button 
{
	import flash.display.DisplayObject;
	import flash.display.MovieClip;
	import flash.events.MouseEvent;	

	/**
	 * @author playhan
	 */
	public class TabButton extends ToggleButton 
	{
		
		public function TabButton(view : DisplayObject = null, frameOn : * = 1, frameOff : * = 2)
		{
			super(view, 1, 2, 3, 4, frameOn, frameOff);
			if (_view != null && _view is MovieClip) MovieClip(_view).gotoAndStop(FRAME_ICON_OFF);
		}
		
		override public function setSelected(selected : Boolean) : void 
		{			
			super.setSelected(selected);

			if (_view != null && _view is MovieClip)
			{
				if(selected) MovieClip(_view).gotoAndStop(FRAME_ICON_ON);
				else MovieClip(_view).gotoAndStop(FRAME_ICON_OFF);
			}
		}
		
		protected override function onClick(event : MouseEvent) : void
		{
			if (selected) return;
			super.onClick(event);
		}

		protected override function onMouseDown(event : MouseEvent) : void
		{
			if (selected) return;
			setPhase(FRAME_DOWN);
			super.onMouseDown(event);
		}

		protected override function onMouseUp(event : MouseEvent) : void
		{
			if (selected) return;
			setPhase(FRAME_DOWN);
			super.onMouseUp(event);
		}

		protected override function onMouseOver(event : MouseEvent) : void
		{
			if (selected) return;
			setPhase(FRAME_OVER);
			super.onMouseOver(event);		
		}

		protected override function onMouseOut(event : MouseEvent) : void
		{
			if (selected) return;
			setPhase(FRAME_UP);
			super.onMouseOut(event);
		}

		protected override function onRollOver(event : MouseEvent) : void
		{
			if (selected) return;
			setPhase(FRAME_OVER);
			super.onRollOver(event);
		}

		protected override function onRollOut(event : MouseEvent) : void
		{
			if (selected) return;
			setPhase(FRAME_UP);
			super.onRollOut(event);
		}		
	}
}
